package odgs.message.client;

import odgs.Connection;
import odgs.ContentsFile;
import odgs.Result;
import odgs.message.Message;
import odgs.message.MessageHandler;
import odgs.message.MessageProcessor;

public class FileDeleteOrderResponseHandler implements MessageHandler
{
	public void execute(MessageProcessor processor, Message msg, Connection con)
	{
		ContentsFile file = (ContentsFile) msg.get("file");
		String path = file.toString();
		
		msg.setName(Message.FILE_DELETE_COMPLETE);
		
		if(processor.getResourceManager().removeFile("data/" + path))
			msg.setResult(Result.CONTENTS_FILE_DELETE_OK);
		else
			msg.setResult(Result.FILE_DELETE_FAIL);
		
		Connection sCon = processor.getNetworkManager().getServerConnection();
		sCon.sendMessage(msg);
	}
}